package org.example.c_0_006;

import org.junit.Test;

import java.util.concurrent.locks.ReentrantLock;

public class T_ReentrantLock {

    @Test
    public void test(){
        ReentrantLock lock = new ReentrantLock();

        lock.lock();
        for (int i = 0; i < 10; i++) {
            new Thread(()->{
                lock.lock();
            }).start();
        }

        try {
            Thread.sleep(10000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        lock.unlock();
    }
}
